﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Strongkeep.Model.Categories;

namespace Strongkeep.Model.Util
{
	/// <summary>
	/// 
	/// </summary>
	public static class CoreHelper
	{
		/// <summary>
		/// 
		/// </summary>
		/// <param name="level"></param>
		/// <returns></returns>
		public static Tier GetTier(int level)
		{
			switch ((int)Math.Ceiling((double)level / 10)) {
				case 0:
				case 1:
					return Tier.Heroic;
				case 2:
					return Tier.Paragon;
				default:
					return Tier.Epic;
			}
		}

		/// <summary>
		/// Get the modifier value, given an ability score.
		/// </summary>
		/// <param name="value"></param>
		/// <returns></returns>
		public static int GetModifier(int abilityScore)
		{
			return Half(abilityScore - 10);
		}

		/// <summary>
		/// Halves the value, rounding down the result.
		/// </summary>
		/// <param name="value"></param>
		/// <returns></returns>
		public static int Half(int value)
		{
			return (int)Math.Floor((double)value / 2);
		}
	}
}
